"""
3
1 3 2
0 2 3
output
2

4
1 5 4 2
10 32 19 21 
output
3
"""
import sys

# area = (min_point, max_point)
def get_next_area(last_area, point):
    if last_area is None:
        cur_area = (point, point)
    else:
        min_point, max_point = last_area
        if point[0] < min_point[0]:
            cur_area = (point, max_point)
        elif point[0] > max_point[0]:
            cur_area = (min_point, point)
        else:
            cur_area = cur_area
    return cur_area


def compare_point(p1, p2):
    if p1[0]<p2[0] and p1[1]<p2[1]:
        return -1
    elif p1[0]>p2[0] and p1[1]>p2[1]:
        return 1
    else:
        return 0

def check_point(area, point):
    if area == None:
        return True
    min_point, max_point = area
    if compare_point(point, min_point) == -1 or compare_point(point, max_point) == 1:
        return True
    else:
        return False


def get_max_count_with_area(point_list, n):
    if n==-1:
        print(n, None, 0)
        return 0, None
    score_list = []
    area_list = []
    for select_flag in [True, False]:
        last_score, last_area = get_max_count_with_area(point_list, n-1)
        cur_score, cur_area = check_cur_status(point_list, n, last_score, last_area, select_flag)
        if cur_score < 0:
            continue
        score_list.append(cur_score)
        area_list.append(cur_area)
    max_idx = max(list(range(len(score_list))), key=lambda x:score_list[x])
    max_score, max_area = score_list[max_idx], area_list[max_idx]
    print(n, max_area, max_score)
    return max_score, max_area

    
def check_cur_status(point_list, n, score, area, select_flag):
    cur_point = point_list[n]
    if check_point(area, cur_point):
        if select_flag:
            score += 1
            cur_area = get_next_area(area, cur_point)
        else:
            score += 0
            cur_area = area
    else:
        if select_flag:
            score = -1
            cur_area = None
        else:
            score += 0
            cur_area = area
    return score, cur_area


def get_max_count(point_list):
    max_score, max_area = get_max_count_with_area(point_list, len(point_list)-1)
    return max_score


if __name__=="__main__":
    N = map(int, input().split())
    x_list = list(map(int, input().split()))
    y_list = list(map(int, input().split()))
    point_list = [(x,y) for x,y in zip(x_list, y_list)]
    # point_list = [[1,0], [2,2], [3,3]]
    # sort points
    point_list = sorted(point_list, key=lambda x:x[0])
    print(get_max_count(point_list))
